<template>
  <div id="app">
    <el-container>
      <el-header>
        <h1>我的演示VueCli</h1>
      </el-header>
      <el-container>
        <el-aside width="250px">
          <el-collapse  accordion>
            <el-collapse-item title="学生管理" name="1">
              <span>
                <router-link to="/student">学生列表</router-link>
              </span>
            </el-collapse-item>
            <el-collapse-item title="老师管理" name="2">
              <span>
                <router-link to="/teacher">老师列表</router-link>
              </span>
            </el-collapse-item>
            <el-collapse-item title="班级管理" name="3">
              <div>
                <el-button type="primary" @click="toStudent()">测试</el-button>
              </div>
            </el-collapse-item>
            <el-collapse-item title="作业管理" name="4">
              <div>4</div>
            </el-collapse-item>
            <el-collapse-item title="内容管理" name="5">
              <div>
                <el-button type="primary" @click="toStudent()">轮播图列表</el-button>
              </div>
            </el-collapse-item>
          </el-collapse>
        </el-aside>
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>

    <!--<HelloWorld msg="Welcome to Your Vue.js App"/>-->
  </div>
</template>

<script>
// import HelloWorld from './components/HelloWorld.vue'

export default {
  name: "Index",
  data(){
    return {

    }
  },methods:{
    toStudent(){
      this.$router.push({path: '/student'});
    }
  },
  beforeCreate() {
  let token =   localStorage.getItem("token");
  console.log(token)
  if(token==""||token==null){
    this.$router.push({path: '/'});
  }
  }

}
</script>

